<script type="text/javascript">
	
function concat1(arr1, arr2) {
	let arr = [];

	let l = 0,
		r = 0;		// l,r分部二指向当前遍历到的元素
	while(l < arr1.length && r < arr2.length) {
		if(arr1[l] >= arr2[r]) {
			arr.push(arr2[r++]);
		} else {
			arr.push(arr1[l++]);
		}
	}

	if(l === arr1.length) {
		let arrTemp = arr2.slice(r);
		arr = arr.concat(arrTemp);
	} else {
		let arrTemp = arr1.slice(l);
		arr = arr.concat(arrTemp);
	}

	return arr;
}

const res = concat1([1,2,3,4], [2, 5, 6,7]);
console.log(res);

</script>